﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Insert.aspx.cs" Inherits="Work.UI.Web.Forms.Admin.Users.Insert" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentHeader" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <asp:ObjectDataSource ID="odsUser" runat="server" 
        onobjectcreating="odsUser_ObjectCreating"
        TypeName="Work.BL.Hibernate.Managers.HUserManager"
        DataObjectTypeName="Work.BL.POCOs.UserPOCO"         
        InsertMethod="Insert">        
    </asp:ObjectDataSource>


    <asp:FormView ID="frvUser" runat="server"
        DataSourceID="odsUser"
        DataKeyNames="Id" DefaultMode="Insert" 
        oniteminserted="frvUser_ItemInserted">
        
        <InsertItemTemplate>

            <table class="addEdit">            
                <tbody>
                    <tr>
                        <th>Name</th>
                        <td>
                            <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("Name") %>' />
                                <asp:RequiredFieldValidator ID="rfvCity" runat="server" 
                                        ErrorMessage="Required field" 
                                        ControlToValidate="txtName" 
                                        ValidationGroup="user" 
                                        Display="Dynamic" />
                                <asp:RegularExpressionValidator ID="revName" runat="server" 
                                        ErrorMessage="Length should not exceed 255"                                                                                                             
                                        ControlToValidate="txtName"
                                        ValidationGroup="user" 
                                        ValidationExpression=".{1,255}"
                                        Display="Dynamic" />
                        </td>
                    </tr>
                    <tr>
                        <th>Email</th>
                        <td>
                            <asp:TextBox ID="txtEmail" runat="server" Text='<%# Bind("Email") %>' />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                        ErrorMessage="Required field" 
                                        ControlToValidate="txtEmail" 
                                        ValidationGroup="user" 
                                        Display="Dynamic" />
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                        ErrorMessage="Length should not exceed 255"                                                                                                             
                                        ControlToValidate="txtEmail"
                                        ValidationGroup="user" 
                                        ValidationExpression=".{1,255}"
                                        Display="Dynamic" />
                        </td>
                    </tr>
                    <tr>
                        <th>Password</th>
                        <td>
                            <asp:TextBox ID="txtPass" runat="server" Text='<%# Bind("Passworsd") %>' />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                        ErrorMessage="Required field" 
                                        ControlToValidate="txtPass" 
                                        ValidationGroup="user" 
                                        Display="Dynamic" />
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                        ErrorMessage="Length should not exceed 255"                                                                                                             
                                        ControlToValidate="txtPass"
                                        ValidationGroup="user" 
                                        ValidationExpression=".{1,255}"
                                        Display="Dynamic" />
                        </td>
                    </tr>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="2">
                            <asp:LinkButton ID="btnSave" runat="server" onclick="btnSave_Click"
                                CausesValidation="true" ValidationGroup="user" CssClass="button1" >
                                <strong>Save</strong>
                            </asp:LinkButton>
                            
                            <asp:LinkButton ID="btnCancel" runat="server" onclick="btnCancel_Click"
                                CausesValidation="false" CssClass="button1">    
                                <strong>Cansel</strong>
                            </asp:LinkButton>
                        </td>
                    </tr>
                </tfoot>
            </table>

        </InsertItemTemplate>

    </asp:FormView>
</asp:Content>
